function(eth_apply TARGET REQUIRED)
	if (ENCRYPTTYPE)
		eth_show_dependency(OPENSSL OpenSSL)
		target_include_directories(${TARGET} PUBLIC ${OPENSSL_INCLUDE_DIRS})
		target_link_libraries(${TARGET} ${OPENSSL_SSL_LIBRARIE})
		target_link_libraries(${TARGET} ${OPENSSL_CRYPTO_LIBRARIE})
	elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
        eth_show_dependency(OPENSSL OpenSSL)
        target_include_directories(${TARGET} PUBLIC ${OPENSSL_INCLUDE_DIRS})
        target_link_libraries(${TARGET} ${OPENSSL_SSL_LIBRARIE})
        target_link_libraries(${TARGET} ${OPENSSL_CRYPTO_LIBRARIE})
	else()
		find_package (OpenSSL)
		set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})

		eth_show_dependency(OPENSSL OpenSSL)
		if (OPENSSL_FOUND)
			target_include_directories(${TARGET} SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIRS})
			target_link_libraries(${TARGET} ${OPENSSL_LIBRARIES})
		elseif (NOT ${REQUIRED} STREQUAL "OPTIONAL")
			message(FATAL_ERROR "OpenSSL library not found")
		endif()
	endif()
endfunction()
